package com.liang.controller;


import com.liang.pojo.Userzarmyxu;
import com.liang.empty.Result;
import com.liang.security.MySecurity;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
import java.util.HashMap;
import org.springframework.beans.factory.annotation.Autowired;;
import java.util.List;
import com.liang.service.UserzarmyxuService;
/**
 *@作者:lsk
 *Controller接口
 *@Date:2023/10/20
*/
@RestController
@RequestMapping("/UserzarmyxuURL")
public class UserzarmyxuController {


	@Autowired
	private UserzarmyxuService userzarmyxuservice;


	/**
	 * 查询一个用户管理的军队和他的下属
	 */
	@MySecurity(methodx = "39")
	@PostMapping("/selectUserArmyDuty")
	public Result insert(@RequestBody Map map){
		return Result.buildMessage(userzarmyxuservice.selectUserArmyDuty(map),"查询下属",200);
	}

	/**
	 insert:(插入)
	*/
	@PostMapping("/insert")
	public Result insert(@RequestBody Userzarmyxu demo){
		Result.buildSuccess(userzarmyxuservice.insert(demo));
		return Result.buildSuccess(demo);
	}



	/**
	 insertOrUpdate(插入或更新(根据主键或唯一索引更新，主键和唯一索引不会改变))
	*/
	@PostMapping("/insertOrUpdate")
	public Result insertOrUpdate(@RequestBody Userzarmyxu demo){
		return Result.buildSuccess(userzarmyxuservice.insertOrUpdate(demo));
	}



	/**
	 insertBath:(批量插入)
	*/
	@PostMapping("/insertBatch")
	public Result insertBatch(@RequestBody List<Userzarmyxu> list){
		return Result.buildSuccess(userzarmyxuservice.insertBatch(list));
	}



	/**
	 insertOrUpdateBatch:(批量插入或更新)
	*/
	@PostMapping("/insertOrUpdateBatch")
	public Result insertOrUpdateBatch(@RequestBody List<Userzarmyxu> list){
		return Result.buildSuccess(userzarmyxuservice.insertOrUpdateBatch(list));
	}



	/**
	 selectList:(根据参数查询集合)
	*/
	@PostMapping("/selectList")
	public Result selectList(@RequestBody Map<String,Object> param){

		return Result.buildSuccess(userzarmyxuservice.selectList(param),userzarmyxuservice.selectCount(param));
	}



	/**
	 selectCount:(根据集合查询数量)
	*/
	@PostMapping("/selectCount")
	public Result selectCount(@RequestBody Map<String,Object> param){
		return Result.buildSuccess(userzarmyxuservice.selectCount(param));
	}



	/**
	 * 删除用户军队
	 */
	@PostMapping("/deleteUserArmy")
	public Result deleteUserArmy(@RequestBody Map param) {
		return Result.buildSuccess(userzarmyxuservice.deleteUserArmy(param));
	}



}